import ajax from '@/utils/HttpUtil'
import { baseUrl as API_HOST } from '/env'

/**
 * 删除或批量删除
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/delete'
 */
export const POST_REPORT_REPORTDATASOURCE_DELETE = API_HOST + '/report/reportdatasource/delete'

/**
 * 删除或批量删除
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportReportdatasourceDelete(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORT_REPORTDATASOURCE_DELETE,
    ...options
  })
}

/**
 * 详情
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/info/:id'
 */
export const GET_REPORT_REPORTDATASOURCE_INFO_ID = API_HOST + '/report/reportdatasource/info/:id'

/**
 * 详情
 * @param {string|number} id Url参数id
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function getReportReportdatasourceInfoId(id, data, options) {
  return ajax({
    method: 'get',
    params: {
      id
    },
    data: data,
    url: GET_REPORT_REPORTDATASOURCE_INFO_ID,
    ...options
  })
}

/**
 * 分页查询
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/list'
 */
export const POST_REPORT_REPORTDATASOURCE_LIST = API_HOST + '/report/reportdatasource/list'

/**
 * 分页查询
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportReportdatasourceList(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORT_REPORTDATASOURCE_LIST,
    ...options
  })
}

/**
 * 不分页查询
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/listAll'
 */
export const POST_REPORT_REPORTDATASOURCE_LIST_ALL = API_HOST + '/report/reportdatasource/listAll'

/**
 * 不分页查询
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportReportdatasourceListAll(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORT_REPORTDATASOURCE_LIST_ALL,
    ...options
  })
}

/**
 * 新增
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/save'
 */
export const POST_REPORT_REPORTDATASOURCE_SAVE = API_HOST + '/report/reportdatasource/save'

/**
 * 新增
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportReportdatasourceSave(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORT_REPORTDATASOURCE_SAVE,
    ...options
  })
}

/**
 * 测试连接
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/testConnection'
 */
export const POST_REPORT_REPORTDATASOURCE_TEST_CONNECTION = API_HOST + '/report/reportdatasource/testConnection'

/**
 * 测试连接
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportReportdatasourceTestConnection(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORT_REPORTDATASOURCE_TEST_CONNECTION,
    ...options
  })
}

/**
 * 修改
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdatasource/update'
 */
export const POST_REPORT_REPORTDATASOURCE_UPDATE = API_HOST + '/report/reportdatasource/update'

/**
 * 修改
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportReportdatasourceUpdate(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORT_REPORTDATASOURCE_UPDATE,
    ...options
  })
}
